/**
 * PHOSIDE: PHosphorylation Site IDentification Engine.
 * Copyright 2009 Digital Biology Lab, University of Missouri.
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 3 of the License, or (at your option) any later
 * version. <p/> This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more
 * details.
 */

package phoside;

import com.jgoodies.looks.Options;
import com.jgoodies.looks.plastic.Plastic3DLookAndFeel;

import java.awt.Dimension;

import javax.swing.UIManager;

import org.apache.commons.lang.SystemUtils;

import phoside.ui.task.PhosideInitTask;
import phoside.ui.task.TaskUtil;

/**
 *
 * @author gjj
 */
public class PhosideMain {
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        init();
        setupLookAndFeel();

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                Phoside.getDesktop().setVisible(true);
            }
        });
    }

    private static void init() {

        // Execute Task in New Thread; pop open JTask Dialog Box.
        PhosideInitTask task = new PhosideInitTask();
        TaskUtil.execute(task);
//        boolean succ = task.success();
//
//        if (succ) {
//
//        }
    }


    private static  void setupLookAndFeel() {
        try {
            if (SystemUtils.IS_OS_WINDOWS) {
                /*
                 * For Windows: just use platform default look & feel.
                 */
                UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            } else if (SystemUtils.IS_OS_MAC) {
                /*
                 * For Mac: move menue bar to OS X default bar (next to Apple
                 * icon)
                 */
//                System.setProperty("apple.laf.useScreenMenuBar", "true");
            } else {
                /*
                 * For Unix platforms, use JGoodies Looks
                 */
//                UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
//                Plastic3DLookAndFeel.set3DEnabled(true);
//                Plastic3DLookAndFeel
//                                .setCurrentTheme(new com.jgoodies.looks.plastic.theme.SkyBluer());
//                Plastic3DLookAndFeel
//                                .setTabStyle(Plastic3DLookAndFeel.TAB_STYLE_METAL_VALUE);
//                Plastic3DLookAndFeel.setHighContrastFocusColorsEnabled(true);
//
//                Options.setDefaultIconSize(new Dimension(18, 18));
//                Options.setHiResGrayFilterEnabled(true);
//                Options.setPopupDropShadowEnabled(true);
//                Options.setUseSystemFonts(true);
//
//                UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE);
//                UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
